<template>
	<!-- 开启盲盒 -->
	<view>
		<view class="main">
			<image src="/static/images/blindbox/openboxbg.png" class="mainbg"></image>
			<image :src="gifUrl" class="dynamicpic"></image>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				activity_id:'',//盲盒id
				order_id:'',//订单id
				price:'',//价格
				type:'buy',//是否是重抽 buy正常抽取 repumping重抽
				open_method:1,//当前抽取的次数类型 1单抽 2五连抽
				gifUrl:'/static/images/dynamicpic.gif'//开盒动画
			}
		},
		onLoad(options) {
			this.gifUrl = `/static/images/dynamicpic.gif?${new Date().getTime()}`
			this.activity_id = options.activity_id;
			this.order_id = options.order_id;
			this.price = options.price;
			this.open_method = options.open_method;
			if(options.type && options.type == 'repumping'){
				this.type = options.type;
			}
			setTimeout(()=>{
				uni.redirectTo({
					url:'/pages/blindbox/blindbox_result?' + this.$url.urlEncode({
						activity_id:this.activity_id,
						price:this.price,
						order_id:this.order_id,
						open_method:this.open_method,
						type:this.type
					})
				})
			},2500)
		}
	}
</script>

<style lang="scss">
.main{
	width: 100vw;
	height: 100vh;
	position: relative;
	
	.mainbg{
		@include img;
		position: absolute;
		z-index: 99;
		top: 0;
		left: 0;
	}
	.dynamicpic{
		@include img;
		position: absolute;
		z-index: 9999;
		top: 50%;
		left: 50%;
		transform: translate(-50%,-50%);
	}
}
</style>
